﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;

namespace Physis.Client {

    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication {

        protected void Application_Start () {

            AreaRegistration.RegisterAllAreas ();

            Configuration.WebApiConfig.Register (GlobalConfiguration.Configuration);

            Configuration.FilterConfig.RegisterGlobalFilters (GlobalFilters.Filters);

            Configuration.RouteConfig.RegisterRoutes (RouteTable.Routes);



            // STATIC BUNDLING OF COMMONLY USED JAVASCRIPT 

            Microsoft.Web.Optimization.Bundle javascriptLibraryBundle = new Microsoft.Web.Optimization.Bundle ("~/Scripts/Bundle", typeof (Microsoft.Web.Optimization.JsMinify));

            javascriptLibraryBundle.AddFile ("~/Scripts/Library/jquery-1.9.1.min.js"); // JQUERY 

            javascriptLibraryBundle.AddFile ("~/Scripts/Library/sugar-1.3.9.min.js"); // SUGAR 

            javascriptLibraryBundle.AddFile ("~/Scripts/Library/jquery-ui-1.10.2.min.js"); // JQUERY UI

            javascriptLibraryBundle.AddFile ("~/Scripts/Library/jquery.jqGrid.min.js"); // JQGRID

            javascriptLibraryBundle.AddFile ("~/Scripts/Library/grid.locale-en.js"); // JQGRID

            javascriptLibraryBundle.AddDirectory ("~/Scripts/Application", "Physis_*.js", false);

            Microsoft.Web.Optimization.BundleTable.Bundles.Add (javascriptLibraryBundle);

        }

        public void Session_OnEnd () {

            System.Diagnostics.Debug.WriteLine ("HERE");

        }

    }

}